package com.observe.self;

import java.util.ArrayList;
import java.util.List;

public class RealWeatherStation implements WeatherStation{

    private String weather;

    private List<Inspect> inspectList;

    public RealWeatherStation() {
        inspectList = new ArrayList<>();
    }

    public String getWeather() {
        return weather;
    }

    public void setWeather(String weather) {
        this.weather = weather;
    }

    @Override
    public void addInspect(Inspect inspect) {
        if (!inspectList.contains(inspect)){
            inspectList.add(inspect);
        }
    }

    @Override
    public void removeInspect(Inspect inspect) {
        if(!inspectList.contains(inspect)){
            inspectList.remove(inspect);
        }
    }

    @Override
    public void notifyInspects() {
        for(Inspect inspect:inspectList){
            inspect.renovateWeather(this.weather);
        }
    }
}
